#include <iostream>
using namespace std;
int main()
{
    int i,n;
    float beg,end,h,term,sum,f(float);
    cout<<"Enter the no. of intervals"<<endl;
    cin>>n;
    cout<<"Enter the end points";
    cin>>beg>>end;
    h=(end-beg)/(float);
    term=f(beg)+f(end);
    for(i=0;i<=n-1;i++)
    {
        term=term+(f(beg)+(i*h))*2;
    }
    sum=term*h/2.0;
    cout<<"The interval="<<sum;
    cin.get();
}

float f(float x)
{
    return(x*x*x);
}
